package version_info

import (
	"github.com/gin-gonic/gin"
	"tao-admin/internal/entity"
)

type VersionService struct {
	VersionManager *VersionManager
}

func NewVersionService() *VersionService {
	return &VersionService{
		VersionManager: &VersionManager{},
	}
}

func (service *VersionService) GetVersionInfos(ctx *gin.Context, versionName string) ([]*entity.VersionInfoEntity, int64, error) {
	condition := &SearchVersionCondition{
		VersionName: &versionName,
	}
	versionList, total, err := service.VersionManager.SearchVersionByConditionMng(ctx, condition)
	if err != nil {
		return nil, 0, err
	}
	return versionList, total, nil
}
